#include "camera.h"

void Camera::binds()
{

}

Camera::Camera()
{
    Stable = FALSE;
    Bounded = FALSE;
    TargetCreated = FALSE;
    binds();
}

Camera::Camera(Vector3 newPOS)
{
    Stable = FALSE;
    Bounded = FALSE;
    TargetCreated = FALSE;
    POS = newPOS;
    binds();
}
Camera::Camera(Vector3 newPOS, Vector3 newDIR)
{
    Stable = FALSE;
    Bounded = FALSE;
    TargetCreated = FALSE;
    POS = newPOS;
    DIR = vector3_normalize(newDIR);
    binds();
}

Camera::Camera(Vector3 newPOS, Vector3 newDIR, Vector3 newUP)
{
    Stable = FALSE;
    Bounded = FALSE;
    TargetCreated = FALSE;
    POS = newPOS;
    DIR = vector3_normalize(newDIR);
    UP = vector3_normalize(newUP);
    binds();
}

Camera::Camera(Vector3 newPOS, Vector3 newDIR, Vector3 newUP, Object *newTarget)
{
    Stable = FALSE;
    Bounded = FALSE;
    Target = newTarget;
    TargetCreated = FALSE;
    POS = newPOS;
    DIR = vector3_normalize(newDIR);
    UP = vector3_normalize(newUP);
    binds();
}

Camera::Camera(Vector3 newPOS, Vector3 newDIR, Vector3 newUP, Object *newTarget, bool Stable_status, bool Bounded_status)
{
    Stable = Stable_status;
    Bounded = Bounded_status;
    Target = newTarget;
    TargetCreated = FALSE;
    POS = newPOS;
    DIR = vector3_normalize(newDIR);
    UP = vector3_normalize(newUP);
    binds();
}

void Camera::bindToObject(Object *newTarget)
{
    if (TargetCreated)
    {
        free(Target);
        TargetCreated = FALSE;
    }
    Target = newTarget;
    Bounded = TRUE;

}

void Camera::bindToPlace(Vector3 newTarget)
{
    if (!TargetCreated)
    {
        Target = new Object;
        TargetCreated = TRUE;
    }
    Target->setPOS(newTarget);
}

void Camera::bindToPlace()
{
    if (!TargetCreated)
    {
        Target = new Object;
        TargetCreated = TRUE;
    }
    Target->setPOS(POS);
}
